package com.example.pcl.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 学生表，存储学生个人信息，包括学号，年级和学院
 * </p>
 *
 * @author xx
 * @since 2024-12-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("students")
@Schema(name = "Students对象", description = "学生表，存储学生个人信息，包括学号，年级和学院")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Students implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "学生ID")
    @TableId(value = "student_id", type = IdType.AUTO)
    private Integer studentId;

    @Schema(description = "学号")
    @NotNull
    @Pattern(regexp = "^(S\\d{11})$", message = "学号必须以S开头后跟11位数字")
    private String studentNumber;

    @Schema(description = "学生姓名")
    @NotNull
    private String name;

    @Schema(description = "年级")
    @NotNull
    private String grade;

    @Schema(description = "学院")
    @NotNull
    private String college;

    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createAt;

    @Schema(description = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateAt;

    @Schema(description = "所学专业")
    @NotNull
    private String major;

    @Schema(description = "关联的用户ID")
    private Integer userId;
}
